;; This is an operating system configuration generated
;; by the graphical installer.

;; MODULES SETTINGS -----------------------------------------------------------

(use-modules
 (gnu)
 (gnu services)
 (gnu services desktop)
 (gnu services xorg) 
 (gnu packages cups)
 (guix channels)
 (guix inferior)
 (guix monads)
 (guix store)
 (srfi srfi-1)
 (ice-9 rdelim)
 (nongnu packages linux)
 (nongnu system linux-initrd))

(use-service-modules
 avahi desktop xorg cups dbus networking ssh sound)

(use-package-modules
 avahi certs gnupg video printers pulseaudio disk
 lisp networking fonts python nss graphviz bash terminals)

;; USER FUNCTIONS --------------------------------------------------------------

;; Remove Services
(define (remove-services types services)
  (remove (lambda (service)
            (any (lambda (type)
                   (eq? (service-kind service) type))
                 types))
          services))

;; START OPERATING-SYSTEM ------------------------------------------------------

(operating-system

 ;; KERNEL SETTINGS -------------------------------------------------------------

 (kernel
  (let*
      ((channels (list (channel
		                    (name 'nonguix)
			                  (url "https://gitlab.com/nonguix/nonguix"))
			                 (channel
			                  (name 'guix)
		 	                  (url "https://git.savannah.gnu.org/git/guix.git"))))
	     (inferior
	      (inferior-for-channels channels)))
    (first (lookup-inferior-packages inferior "linux" "5.9.13"))))

 (firmware (cons* amdgpu-firmware
	                atheros-firmware
		              %base-firmware))
 (initrd microcode-initrd)

 (kernel-arguments '("acpi_backlight=vendor"))

 ;; LOCALE SETTINGS -------------------------------------------------------------

 (locale "en_US.utf8")
 (timezone "America/Sao_Paulo")
 (keyboard-layout (keyboard-layout "br"))
 (host-name "guix")

 ;; USER SETTINGS ---------------------------------------------------------------
 
 (users (cons* (user-account
                (name "rxf4el")
                (comment "Rxf4El")
                (group "users")
                (home-directory "/home/rxf4el")
                (supplementary-groups
                 '("wheel" "netdev" "audio" "video"
                   "input" "avahi")))
               %base-user-accounts))
 
 ;; PACKAGES --------------------------------------------------------------------

 (packages (cons*
            (specification->package "ccache")
            (specification->package "emacs")
            (specification->package "emacs-guix")
	          (specification->package "stumpwm")
            (specification->package "xterm")
            (specification->package "nss-certs")
            %base-packages))

 ;; SERVICES ---------------------------------------------------------------------  
 
 (services
  (cons*

   ;; Set keyboard layout
   ;;(set-xorg-configuration
   ;; (xorg-configuration
   ;;  (keyboard-layout keyboard-layout)))
   
   ;; OpenSSH 
   (service openssh-service-type
            (openssh-configuration
             (password-authentication? #t)))
   
   ;; Cups for printing
   (service cups-service-type
            (cups-configuration
             (web-interface? #t)
             (browsing? #t)
             (default-paper-size "A4")))
   
   (remove-services
	  (list gdm-service-type
	        ntp-service-type) %desktop-services)))
 
 ;; BOOTLOADER -------------------------------------------------------------------
 
 (bootloader
  (bootloader-configuration
   (bootloader grub-efi-bootloader)
   (target "/boot/efi")
   (keyboard-layout keyboard-layout)))
 
 (swap-devices
  (list (uuid "06b14cfe-7cb1-4100-8477-302419782e42")))
 
 (file-systems
  (cons* (file-system
          (mount-point "/media/data")
          (device
           (uuid "36198c60-f4b3-489b-8b08-e1fcc6f8f8e6"
                 'ext4))
          (type "ext4"))
         (file-system
          (mount-point "/")
          (device
           (uuid "47d39e84-69b8-4293-b4db-9832a908428f"
                 'ext4))
          (type "ext4"))
         (file-system
          (mount-point "/boot/efi")
          (device (uuid "6A61-DCAD" 'fat32))
          (type "vfat"))
         %base-file-systems))
 
 ;; Allow resolution of '.local' host names with mDNS.
 (name-service-switch %mdns-host-lookup-nss)

 ;; END OPERATING SYSTEM ---------------------------------------------------------
 )
